/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.model.qnrlibrary;


import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;


/**
 *
 * @author rejun001
 */
@Entity
@Table( name = "questionnaires" )
@XmlRootElement
@NamedQueries( 
{
    @NamedQuery( name = "Questionnaires.findAll" , query = "SELECT q FROM Questionnaires q" ) ,
    @NamedQuery( name = "Questionnaires.findByQnrId" , query = "SELECT q FROM Questionnaires q WHERE q.qnrId = :qnrId" ) ,
    @NamedQuery( name = "Questionnaires.findByFormNumber" , query = "SELECT q FROM Questionnaires q WHERE q.formNumber = :formNumber" ) ,
    @NamedQuery( name = "Questionnaires.findByTitle" , query = "SELECT q FROM Questionnaires q WHERE q.title = :title" ) ,
    @NamedQuery( name = "Questionnaires.findBySubTitle" , query = "SELECT q FROM Questionnaires q WHERE q.subTitle = :subTitle" ) ,
    @NamedQuery( name = "Questionnaires.findByStatus" , query = "SELECT q FROM Questionnaires q WHERE q.status = :status" ) ,
    @NamedQuery( name = "Questionnaires.findByRefPeriod" , query = "SELECT q FROM Questionnaires q WHERE q.refPeriod = :refPeriod" ) ,
    @NamedQuery( name = "Questionnaires.findBySectorSurveyCode" , query = "SELECT q FROM Questionnaires q WHERE q.sectorSurveyCode = :sectorSurveyCode" ) ,
    @NamedQuery( name = "Questionnaires.findByFormLanguage" , query = "SELECT q FROM Questionnaires q WHERE q.formLanguage = :formLanguage" ) ,
    @NamedQuery( name = "Questionnaires.findByFormDisplayNumber" , query = "SELECT q FROM Questionnaires q WHERE q.formDisplayNumber = :formDisplayNumber" ) ,
    @NamedQuery( name = "Questionnaires.findByOmbNumber" , query = "SELECT q FROM Questionnaires q WHERE q.ombNumber = :ombNumber" ) ,
    @NamedQuery( name = "Questionnaires.findByOmbNumberExpirationDate" , query = "SELECT q FROM Questionnaires q WHERE q.ombNumberExpirationDate = :ombNumberExpirationDate" ) ,
    @NamedQuery( name = "Questionnaires.findByCreatedBy" , query = "SELECT q FROM Questionnaires q WHERE q.createdBy = :createdBy" ) ,
    @NamedQuery( name = "Questionnaires.findByDateCreated" , query = "SELECT q FROM Questionnaires q WHERE q.dateCreated = :dateCreated" ) ,
    @NamedQuery( name = "Questionnaires.findByModifiedBy" , query = "SELECT q FROM Questionnaires q WHERE q.modifiedBy = :modifiedBy" ) ,
    @NamedQuery( name = "Questionnaires.findByDateModified" , query = "SELECT q FROM Questionnaires q WHERE q.dateModified = :dateModified" ) ,
    @NamedQuery( name = "Questionnaires.findByRequiresDataCaptureData" , query = "SELECT q FROM Questionnaires q WHERE q.requiresDataCaptureData = :requiresDataCaptureData" ) ,
    @NamedQuery( name = "Questionnaires.findByDueDate" , query = "SELECT q FROM Questionnaires q WHERE q.dueDate = :dueDate" ) ,
    @NamedQuery( name = "Questionnaires.findBySegmentationStyle" , query = "SELECT q FROM Questionnaires q WHERE q.segmentationStyle = :segmentationStyle" ) ,
    @NamedQuery( name = "Questionnaires.findByDatePublished" , query = "SELECT q FROM Questionnaires q WHERE q.datePublished = :datePublished" ) ,
    @NamedQuery( name = "Questionnaires.findByPublishedFlag" , query = "SELECT q FROM Questionnaires q WHERE q.publishedFlag = :publishedFlag" ) ,
    @NamedQuery( name = "Questionnaires.findBySurvey" , query = "SELECT q FROM Questionnaires q WHERE q.survey = :survey" )
} )
public class Questionnaires implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic( optional = false )
    @Column( name = "qnr_id" )
    private String qnrId;
    @Basic( optional = false )
    @Column( name = "form_number" )
    private String formNumber;
    @Basic( optional = false )
    @Column( name = "title" )
    private String title;
    @Column( name = "sub_title" )
    private String subTitle;
    @Basic( optional = false )
    @Column( name = "status" )
    private String status;
    @Basic( optional = false )
    @Column( name = "ref_period" )
    private String refPeriod;
    @Basic( optional = false )
    @Column( name = "sector_survey_code" )
    private String sectorSurveyCode;
    @Column( name = "form_language" )
    private String formLanguage;
    @Column( name = "form_display_number" )
    private String formDisplayNumber;
    @Column( name = "omb_number" )
    private String ombNumber;
    @Column( name = "omb_number_expiration_date" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date ombNumberExpirationDate;
    @Basic( optional = false )
    @Column( name = "created_by" )
    private String createdBy;
    @Basic( optional = false )
    @Column( name = "date_created" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateCreated;
    @Column( name = "modified_by" )
    private String modifiedBy;
    @Column( name = "date_modified" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateModified;
    @Basic( optional = false )
    @Column( name = "requires_data_capture_data" )
    private String requiresDataCaptureData;
    @Column( name = "due_date" )
    private String dueDate;
    @Column( name = "segmentation_style" )
    private String segmentationStyle;
    @Column( name = "date_published" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date datePublished;
    @Column( name = "published_flag" )
    private Character publishedFlag;
    @Column( name = "survey" )
    private String survey;
    @OneToMany( cascade = CascadeType.ALL , mappedBy = "qnrId" )
    private Collection<QuestionnaireQuestions> questionnaireQuestionsCollection;


    public Questionnaires()
    {
    }


    public Questionnaires( String qnrId )
    {
        this.qnrId = qnrId;
    }


    public Questionnaires( String qnrId , String formNumber , String title , String status , String refPeriod , String sectorSurveyCode , String createdBy , Date dateCreated , String requiresDataCaptureData )
    {
        this.qnrId = qnrId;
        this.formNumber = formNumber;
        this.title = title;
        this.status = status;
        this.refPeriod = refPeriod;
        this.sectorSurveyCode = sectorSurveyCode;
        this.createdBy = createdBy;
        this.dateCreated = dateCreated;
        this.requiresDataCaptureData = requiresDataCaptureData;
    }


    public String getQnrId()
    {
        return qnrId;
    }


    public void setQnrId( String qnrId )
    {
        this.qnrId = qnrId;
    }


    public String getFormNumber()
    {
        return formNumber;
    }


    public void setFormNumber( String formNumber )
    {
        this.formNumber = formNumber;
    }


    public String getTitle()
    {
        return title;
    }


    public void setTitle( String title )
    {
        this.title = title;
    }


    public String getSubTitle()
    {
        return subTitle;
    }


    public void setSubTitle( String subTitle )
    {
        this.subTitle = subTitle;
    }


    public String getStatus()
    {
        return status;
    }


    public void setStatus( String status )
    {
        this.status = status;
    }


    public String getRefPeriod()
    {
        return refPeriod;
    }


    public void setRefPeriod( String refPeriod )
    {
        this.refPeriod = refPeriod;
    }


    public String getSectorSurveyCode()
    {
        return sectorSurveyCode;
    }


    public void setSectorSurveyCode( String sectorSurveyCode )
    {
        this.sectorSurveyCode = sectorSurveyCode;
    }


    public String getFormLanguage()
    {
        return formLanguage;
    }


    public void setFormLanguage( String formLanguage )
    {
        this.formLanguage = formLanguage;
    }


    public String getFormDisplayNumber()
    {
        return formDisplayNumber;
    }


    public void setFormDisplayNumber( String formDisplayNumber )
    {
        this.formDisplayNumber = formDisplayNumber;
    }


    public String getOmbNumber()
    {
        return ombNumber;
    }


    public void setOmbNumber( String ombNumber )
    {
        this.ombNumber = ombNumber;
    }


    public Date getOmbNumberExpirationDate()
    {
        return ombNumberExpirationDate;
    }


    public void setOmbNumberExpirationDate( Date ombNumberExpirationDate )
    {
        this.ombNumberExpirationDate = ombNumberExpirationDate;
    }


    public String getCreatedBy()
    {
        return createdBy;
    }


    public void setCreatedBy( String createdBy )
    {
        this.createdBy = createdBy;
    }


    public Date getDateCreated()
    {
        return dateCreated;
    }


    public void setDateCreated( Date dateCreated )
    {
        this.dateCreated = dateCreated;
    }


    public String getModifiedBy()
    {
        return modifiedBy;
    }


    public void setModifiedBy( String modifiedBy )
    {
        this.modifiedBy = modifiedBy;
    }


    public Date getDateModified()
    {
        return dateModified;
    }


    public void setDateModified( Date dateModified )
    {
        this.dateModified = dateModified;
    }


    public String getRequiresDataCaptureData()
    {
        return requiresDataCaptureData;
    }


    public void setRequiresDataCaptureData( String requiresDataCaptureData )
    {
        this.requiresDataCaptureData = requiresDataCaptureData;
    }


    public String getDueDate()
    {
        return dueDate;
    }


    public void setDueDate( String dueDate )
    {
        this.dueDate = dueDate;
    }


    public String getSegmentationStyle()
    {
        return segmentationStyle;
    }


    public void setSegmentationStyle( String segmentationStyle )
    {
        this.segmentationStyle = segmentationStyle;
    }


    public Date getDatePublished()
    {
        return datePublished;
    }


    public void setDatePublished( Date datePublished )
    {
        this.datePublished = datePublished;
    }


    public Character getPublishedFlag()
    {
        return publishedFlag;
    }


    public void setPublishedFlag( Character publishedFlag )
    {
        this.publishedFlag = publishedFlag;
    }


    public String getSurvey()
    {
        return survey;
    }


    public void setSurvey( String survey )
    {
        this.survey = survey;
    }


    @XmlTransient
    public Collection<QuestionnaireQuestions> getQuestionnaireQuestionsCollection()
    {
        return questionnaireQuestionsCollection;
    }


    public void setQuestionnaireQuestionsCollection( Collection<QuestionnaireQuestions> questionnaireQuestionsCollection )
    {
        this.questionnaireQuestionsCollection = questionnaireQuestionsCollection;
    }


    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += ( qnrId != null ? qnrId.hashCode() : 0 );
        return hash;
    }


    @Override
    public boolean equals( Object object )
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if ( !( object instanceof Questionnaires ) )
        {
            return false;
        }
        Questionnaires other = (Questionnaires) object;
        if ( ( this.qnrId == null && other.qnrId != null ) || ( this.qnrId != null && !this.qnrId.equals( other.qnrId ) ) )
        {
            return false;
        }
        return true;
    }


    @Override
    public String toString()
    {
        return "idea.model.qnrlibrary.Questionnaires[ qnrId=" + qnrId + " ]";
    }
    
}
